home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
macros
/
latex209
/
contrib
/
natbib
/
natbib.sty
< prev
next >
Wrap
Text File
|
1994-05-30
|
11KB
|
261 lines
%%
%% This is file `natbib.sty', generated
%% on <1994/5/27> with the docstrip utility (2.2e).
%%
%% The original source files were:
%%
%% natbib.dtx (with options: `package,209,all')
%%
%% The original file natbib.dtx contains LaTeX text as comments, which
%% may be processed by LaTeXing the appropriate driver (.drv) file.
%% This produces a more detailed description of the macro usage and of its
%% coding than is to be found in the limited remaining comments in this file.
%%
%% >>>>> Start of decommented natbib.dtx >>>>>>>
%%======================NATBIB.DTX========================================
\def\filename{natbib}
\def\fileversion{5.0}
\def\filedate{1994/05/18}
%-------------------------------------------------------------------
% NOTICE:
% This file may be used for non-profit purposes.
% It may not be distributed in exchange for money,
% other than distribution costs.
%
% The author provides it `as is' and does not guarantee it in any way.
%
%% Copyright (C) 1994 Patrick W. Daly
% Max-Planck-Institut f\"ur Aeronomie
% Postfach 20
% D-37189 Katlenburg-Lindau
% Germany
%
% E-mail:
% SPAN-- nsp::linmpi::daly (note nsp also known as ecd1)
% Internet-- daly@linax1.dnet.gwdg.de
%-----------------------------------------------------------
% Intended mainly for author-year style citations, but will work with
% numericals as well.
%
% If author-year style selected, then \bibitem must have one of the
% following forms:
% \bibitem[Jones et al.(1990)]{key}...
% \bibitem[Jones et al., 1990]{key}...
% \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
% et al.}{1990}]{key}...
% \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
% \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
% \bibitem[\protect\citename{Jones et al., }1990]{key}...
% \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
%
% This is either to be made up manually, or to be generated by an
% appropriate .bst file with BibTeX.
%
% Then, \cite{key} ==>> Jones et al. (1990)
% \cite[]{key} ==>> (Jones et al., 1990)
% Multiple citations as normal:
% \cite[]{key1,key2} ==>> (Jones et al., 1990; Smith, 1989)
% or (Jones et al., 1990, 1991)
% Optional notes as:
% \cite[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2)
% \cite[e.g.,][]{key} ==>> (e.g., Jones et al., 1990)
% \cite[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)
% (Note: in standard LaTeX, only one note is allowed, after the ref.
% Here, one note is like the standard, two make pre- and post-notes.)
%
% Additional citation possibilities (author-year only)
% \citeauthor{key} ==>> Jones et al.
% \citeyear{key} ==>> 1990
% (Multiple keys NOT allowed!)
%
% Defining the citation style of a given bib style:
% Use \bibpunct with 6 arguments:
% 1. opening bracket for citation
% 2. closing bracket
% 3. citation separator (for multiple citations in one \cite)
% 4. the letter n for numerical styles, else anything for author-year
% 5. punctuation between authors and date
% 6. punctuation between years when common authors missing
% Example (and default) \bibpunct{(}{)}{;}{a}{,}{,}
%
% To make this automatic for a given bib style, named newbib, say, add
% to this style file
% \bibstyle@newbib{\bibpunct... + any other redefinitions (see examples)}
% Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to
% be called on THE NEXT LATEX RUN (via the aux file).
%
% LaTeX2e Options: (for selecting punctuation)
% round - round parentheses are used (default)
% square - square braces are used
% colon - multiple citations separated by colon (default)
% comma - separated by comma
% authoryear - selects author-year citations (default)
% numbers- selects numerical citations
% nobibstyle - deactivates punctuation selection via \bibliographystyle
% Note: normally the punctuation style defined by \bibstyle@xxx and invoked
% with \bibliographystyle{xxx} dominates; with option nobibstyle
% this is no longer the case.
% LaTeX2e options are called as, e.g.
% \usepackage[square,comma]{natbib}
%-----------------------------------------------------------
\typeout{Package: `\filename' v\fileversion\space <\filedate> --P.W.Daly}
\newif\if@twoOnine \let\if@twoOnine=\if@compatibility
\@ifundefined{documentclass}{
\@twoOninetrue
}{
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{\filename}[\filedate\space (PWD)]
}
% Define citation punctuation for some author-year styles
% One may add and delete at this point
\def\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}}
\def\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}
\def\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}
\def\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,}}
\def\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}
% Define citation punctuation for some numerical styles
% One may add and delete at this point
\def\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
\gdef\@biblabel##1{##1.}}
\def\bibstyle@esa{\bibpunct{(}{)}{,}{n}{}{}%
\gdef\@biblabel##1{##1.\hspace{1em}}%
\gdef\@cite##1##2##3{\@citebegin Ref.~##1\if@tempswa,
##3\fi\@citeend}}
\def\bibstyle@nature{\bibpunct{}{}{,}{n}{}{}%
\gdef\@biblabel##1{##1.}%
\gdef\@cite##1##2##3{\unskip\mbox{$^{##1}$}}}
% The standard LaTeX styles
\def\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{}}
\let\bibstyle@alpha=\bibstyle@plain
\let\bibstyle@abbrv=\bibstyle@plain
\let\bibstyle@unsrt=\bibstyle@plain
\if@twoOnine\else
\DeclareOption{round}{\def\@citebegin{(} \def\@citeend{)}}
\DeclareOption{square}{\def\@citebegin{[} \def\@citeend{]}}
\DeclareOption{comma}{\def\@citesep{,}}
\DeclareOption{colon}{\def\@citesep{;}}
\DeclareOption{numbers}{\let\@bibsetup=\@bibsetnum
\let\@citex=\@citexnum
\let\@biblabel=\@biblabelnum
\let\@cite=\@citenum
\ExecuteOptions{square,comma}}
\DeclareOption{super}{\ExecuteOptions{numbers}%
\def\@cite##1##2##3{\unskip\mbox{$^{##1}$%
\if@tempswa(##3)\fi}}}
\DeclareOption{authoryear}{}
\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
\fi
\def\@cite#1#2#3{\if@tempswa\@citebegin\if#2\@empty\else#2 \fi
#1\if#3\@empty\else, #3\fi\@citeend\else#1\fi}
\def\@citenum#1#2#3{\@citebegin\if@tempswa\if#2\@empty\else#2 \fi\fi
#1\if#3\@empty\else, #3\fi\@citeend}
\def\@citexnum[#1][#2]#3{\if@filesw\immediate\write
\@auxout{\string\citation{#3}}\fi
\let\@citea\@empty
\@cite{\@for\@citeb:=#3\do
{\@citea\def\@citea{\@citesep\penalty\@m\ }%
\def\@tempa##1##2\@nil{\edef\@citeb{\if##1\space##2\else##1##2\fi}}%
\expandafter\@tempa\@citeb\@nil
\@ifundefined{b@\@citeb}{{\reset@font\bfseries ?}\@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
\hbox{\csname b@\@citeb\endcsname}}}{#1}{#2}}
\def\@citex[#1][#2]#3{\if@filesw\immediate\write
\@auxout{\string\citation{#3}}\fi
\let\@citea\@empty
\@cite{\let\@citenm\@empty
\@for\@citeb:=#3\do
{\def\@tempa##1##2\@nil{\edef\@citeb{\if##1\space##2\else##1##2\fi}}%
\expandafter\@tempa\@citeb\@nil
\@ifundefined{b@\@citeb}{\@citea{\reset@font\bfseries ?}\@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
{\let\@citemm=\@citenm
\@cite@parse{\@citeb}%
\if@tempswa
\ifx\@citemm\@citenm\@yrsep\else\@citea{\@citenm}\@auyrsep\fi
\ \@citedt \def\@citea{\@citesep\ }%
\else
\ifx\@citemm\@citenm, \@citedt\else\@citea{\@citenm}
\@citebegin\@citedt\fi
\def\@citea{\@citeend\@citesep\ }%
\fi}}\if@tempswa\else\@citeend\fi}{#1}{#2}}
\def\@biblabel#1{\hfill}
\def\@biblabelnum#1{[#1]}
\def\@bibsetnum#1{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth \advance\leftmargin\labelsep}
\def\@bibsetup#1{\leftmargin=1em\itemindent=-\leftmargin}
\if@twoOnine
\def\@citebegin{(} \def\@citeend{)} \def\@citesep{;}
\else
\ExecuteOptions{authoryear,round,colon}
\ProcessOptions
\fi
\def\@auyrsep{,} \def\@yrsep{,}
\def\bibstyle#1{\@ifundefined{bibstyle@#1}{\relax}
{\csname bibstyle@#1\endcsname}}
\if@twoOnine
\let\ori@document=\document
\def\document{\ori@document\global\let\bibstyle=\@gobble}
\else
\AtBeginDocument{\global\let\bibstyle=\@gobble}
\fi
\def\bibpunct#1#2#3#4#5#6{\gdef\@citebegin{#1}\gdef\@citeend{#2}\gdef
\@citesep{#3}\ifx #4n\global\let\@bibsetup=\@bibsetnum
\global\let\@citex=\@citexnum
\global\let\@biblabel=\@biblabelnum
\global\let\@cite=\@citenum\fi
\gdef\@auyrsep{#5}\gdef\@yrsep{#6}}
\def\cite{\@ifnextchar [{\@tempswatrue\@citex@}{\@tempswafalse
\@citex@[]}}
\def\@citex@[#1]{\@ifnextchar [{\@citex[#1]}{\@citex[][#1]}}
\def\citeauthor#1{\ifx\@citex\@citexnum{\reset@font\bfseries(author?)}\@warning
{Cannot use \string\citeauthor\space with numerical citations}\else
\@ifundefined{b@#1}{{\reset@font\bfseries ?}\@warning
{Citation `#1' on page \thepage \space undefined}}%
{\@cite@parse{#1}\@citenm}\fi}
\def\citeyear#1{\ifx\@citex\@citexnum{\reset@font\bfseries(year?)}\@warning
{Cannot use \string\citeyear\space with numerical citations}\else
\@ifundefined{b@#1}{{\reset@font\bfseries ?}\@warning
{Citation `#1' on page \thepage \space undefined}}%
{\@cite@parse{#1}\@citedt}\fi}
\def\@cite@parse#1{%
{\let\prm=\relax\let\psf=\relax\let\ptt=\relax\let\pbf=\relax
\let\psl=\relax\let\psc=\relax\let\pit=\relax\let\pem=\relax
\let\prmfamily=\relax\let\psffamily=\relax\let\pttfamily=\relax
\let\pbfseries=\relax\let\pslshape=\relax\let\pscshape=\relax
\let\pitshape=\relax\let\pmdseries=\relax\let\pupshape=\relax
\let\pc=\relax \let\pd=\relax \let\pb=\relax
\xdef\@tempa{\csname b@#1\endcsname\relax}}%
\expandafter\@citez\@tempa()\@nil}
\def\@citez#1(#2)#3\@nil{\gdef\@citenm{#1}\gdef\@citedt{#2}%
\if!#2!\expandafter\@citeapalk#1\@nil\fi}
\def\@citeapalk#1, #2\@nil{\gdef\@citenm{#1}\gdef\@citedt{#2}}
\def\citeauthoryear#1#2#3{\ifx#3\relax #1(#2)\else #2(#3)\fi}
\def\citestarts{\@citebegin}
\def\citeends{\@citeend}
\def\betweenauthors{and}
\def\astroncite#1#2{#1(#2)}
\def\citename#1{#1}
\def\harvarditem{\@ifnextchar[{\@harvarditem}{\@harvarditem[\@empty]}}
\def\@harvarditem[#1]#2#3#4{\if!#1!\bibitem[#2(#3)]{#4}\else
\bibitem[#1(#3)]{#4}\fi }
\@ifundefined{chapter}{\def\bibsection{\section*{\refname
\@mkboth{\uppercase{\refname}}{\uppercase{\refname}}}}}{\def
\bibsection{\chapter*{\bibname
\@mkboth{\uppercase{\bibname}}{\uppercase{\bibname}}}}}
\def\thebibliography#1{\bibsection\parindent \z@\list
{\@biblabel{\arabic{enumiv}}}{\@bibsetup{#1}%
\usecounter{enumiv}\let\p@enumiv\@empty
\def\theenumiv{\arabic{enumiv}}}%
\def\newblock{\hskip .11em plus.33em minus.07em}%
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax \bibfont}
\let\bibfont=\relax
\def\endthebibliography{%
\def\@noitemerr{\@warning{Empty `thebibliography' environment}}%
\endlist\vskip-\lastskip}
\@ifundefined{reset@font}{\let\reset@font=\relax}{}
\@ifundefined{bfseries}{\let\bfseries=\bf}{}
%% <<<<< End of decommented file <<<<<<
%%
%% End of file natbib.sty.